/* Driver template for the LEMON parser generator.
** The author disclaims copyright to this source code.
*/
/* First off, code is include which follows the "include" declaration
** in the input file. */
#include <stdio.h>
#line 56 "parse.y"

#include "edb_main.h"
#include "edb_msg_parser.h"

#line 14 "parse.c"
/* Next is all token values, in a form suitable for use by makeheaders.
** This section will be null unless lemon is run with the -m switch.
*/
/* 
** These constants (all generated automatically by the parser generator)
** specify the various kinds of tokens (terminals) that the parser
** understands. 
**
** Each symbol here is a terminal symbol in the grammar.
*/
/* Make sure the INTERFACE macro is defined.
*/
#ifndef INTERFACE
# define INTERFACE 1
#endif
/* The next thing included is series of defines which control
** various aspects of the generated parser.
**    YYCODETYPE         is the data type used for storing terminal
**                       and nonterminal numbers.  "unsigned char" is
**                       used if there are fewer than 250 terminals
**                       and nonterminals.  "int" is used otherwise.
**    YYNOCODE           is a number of type YYCODETYPE which corresponds
**                       to no legal terminal or nonterminal number.  This
**                       number is used to fill in empty slots of the hash 
**                       table.
**    YYFALLBACK         If defined, this indicates that one or more tokens
**                       have fall-back values which should be used if the
**                       original value of the token will not parse.
**    YYACTIONTYPE       is the data type used for storing terminal
**                       and nonterminal numbers.  "unsigned char" is
**                       used if there are fewer than 250 rules and
**                       states combined.  "int" is used otherwise.
**    edbParserTOKENTYPE     is the data type used for minor tokens given 
**                       directly to the parser from the tokenizer.
**    YYMINORTYPE        is the data type used for all minor tokens.
**                       This is typically a union of many types, one of
**                       which is edbParserTOKENTYPE.  The entry in the union
**                       for base tokens is called "yy0".
**    YYSTACKDEPTH       is the maximum depth of the parser's stack.  If
**                       zero the stack is dynamically sized using realloc()
**    edbParserARG_SDECL     A static variable declaration for the %extra_argument
**    edbParserARG_PDECL     A parameter declaration for the %extra_argument
**    edbParserARG_STORE     Code to store %extra_argument into yypParser
**    edbParserARG_FETCH     Code to extract %extra_argument from yypParser
**    YYNSTATE           the combined number of states.
**    YYNRULE            the number of rules in the grammar
**    YYERRORSYMBOL      is the code number of the error symbol.  If not
**                       defined, then do no error processing.
*/
#define YYCODETYPE unsigned char
#define YYNOCODE 87
#define YYACTIONTYPE unsigned char
#define edbParserTOKENTYPE Token
typedef union {
  edbParserTOKENTYPE yy0;
  AttrList * yy6;
  Token yy94;
  Expr* yy95;
  Token * yy108;
  AttrValue * yy123;
} YYMINORTYPE;
#ifndef YYSTACKDEPTH
#define YYSTACKDEPTH 100
#endif
#define edbParserARG_SDECL edbParseContext *pParse;
#define edbParserARG_PDECL ,edbParseContext *pParse
#define edbParserARG_FETCH edbParseContext *pParse = yypParser->pParse
#define edbParserARG_STORE yypParser->pParse = pParse
#define YYNSTATE 107
#define YYNRULE 58
#define YY_NO_ACTION      (YYNSTATE+YYNRULE+2)
#define YY_ACCEPT_ACTION  (YYNSTATE+YYNRULE+1)
#define YY_ERROR_ACTION   (YYNSTATE+YYNRULE)

/* Next are that tables used to determine what action to take based on the
** current state and lookahead token.  These tables are used to implement
** functions that take a state number and lookahead value and return an
** action integer.  
**
** Suppose the action integer is N.  Then the action is determined as
** follows
**
**   0 <= N < YYNSTATE                  Shift N.  That is, push the lookahead
**                                      token onto the stack and goto state N.
**
**   YYNSTATE <= N < YYNSTATE+YYNRULE   Reduce by rule N-YYNSTATE.
**
**   N == YYNSTATE+YYNRULE              A syntax error has occurred.
**
**   N == YYNSTATE+YYNRULE+1            The parser accepts its input.
**
**   N == YYNSTATE+YYNRULE+2            No such action.  Denotes unused
**                                      slots in the yy_action[] table.
**
** The action table is constructed as a single large table named yy_action[].
** Given state S and lookahead X, the action is computed as
**
**      yy_action[ yy_shift_ofst[S] + X ]
**
** If the index value yy_shift_ofst[S]+X is out of range or if the value
** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X or if yy_shift_ofst[S]
** is equal to YY_SHIFT_USE_DFLT, it means that the action is not in the table
** and that yy_default[S] should be used instead.  
**
** The formula above is for computing the action when the lookahead is
** a terminal symbol.  If the lookahead is a non-terminal (as occurs after
** a reduce action) then the yy_reduce_ofst[] array is used in place of
** the yy_shift_ofst[] array and YY_REDUCE_USE_DFLT is used in place of
** YY_SHIFT_USE_DFLT.
**
** The following are the tables generated in this section:
**
**  yy_action[]        A single table containing all actions.
**  yy_lookahead[]     A table containing the lookahead for each entry in
**                     yy_action.  Used to detect hash collisions.
**  yy_shift_ofst[]    For each state, the offset into yy_action for
**                     shifting terminals.
**  yy_reduce_ofst[]   For each state, the offset into yy_action for
**                     shifting non-terminals after a reduce.
**  yy_default[]       Default action for each state.
*/
static const YYACTIONTYPE yy_action[] = {
 /*     0 */     8,   76,   78,   56,   49,   98,   52,   95,   50,   48,
 /*    10 */     1,   14,   15,   55,    6,    2,   76,   78,    8,   23,
 /*    20 */    53,   12,   12,   13,   13,   13,   13,  106,   11,   11,
 /*    30 */    11,   11,   17,   17,    8,    8,   10,   30,   24,   12,
 /*    40 */    12,   13,   13,   13,   13,    8,   11,   11,   11,   11,
 /*    50 */    17,   17,    8,    8,   10,   18,   39,   15,   36,    8,
 /*    60 */    49,   98,   52,  106,   60,  106,   12,   12,   13,   13,
 /*    70 */    13,   13,    8,   11,   11,   11,   11,   17,   17,    8,
 /*    80 */     8,   10,   13,   13,   13,   13,    8,   11,   11,   11,
 /*    90 */    11,   17,   17,    8,    8,   10,    8,   75,   58,   90,
 /*   100 */    11,   11,   11,   11,   17,   17,    8,    8,   10,  101,
 /*   110 */   101,   91,   42,  101,  100,   85,   93,   68,    7,  106,
 /*   120 */     8,    8,   10,   65,   82,   76,   78,   62,   17,   17,
 /*   130 */     8,    8,   10,   22,  166,   21,   97,   51,  102,    3,
 /*   140 */    59,   74,   45,   98,   52,   66,  105,   92,   63,    3,
 /*   150 */    76,   78,   88,   24,   47,  104,   43,   98,   52,   46,
 /*   160 */    98,   52,  107,   85,   93,   29,   54,   57,   81,   81,
 /*   170 */    81,   87,   52,   80,   66,   41,   81,   99,   99,   38,
 /*   180 */    89,   24,  106,   83,   96,   35,  106,   40,   94,    5,
 /*   190 */    37,  116,  106,   33,  106,  106,   81,  106,   44,   27,
 /*   200 */    69,   71,   70,  115,   86,   72,   84,   73,   67,   16,
 /*   210 */    34,   28,  103,   19,   31,   61,   64,   77,   79,    9,
 /*   220 */    25,   32,   24,   20,    4,   26,  167,   10,
};
static const YYCODETYPE yy_lookahead[] = {
 /*     0 */    23,   32,   33,   10,   72,   73,   74,   23,   76,   16,
 /*    10 */    17,   34,   35,   20,   12,   22,   32,   33,   23,    9,
 /*    20 */    78,   44,   45,   46,   47,   48,   49,   85,   51,   52,
 /*    30 */    53,   54,   55,   56,   57,   58,   59,   13,   14,   44,
 /*    40 */    45,   46,   47,   48,   49,   23,   51,   52,   53,   54,
 /*    50 */    55,   56,   57,   58,   59,   11,   78,   35,   78,   23,
 /*    60 */    72,   73,   74,   85,   76,   85,   44,   45,   46,   47,
 /*    70 */    48,   49,   23,   51,   52,   53,   54,   55,   56,   57,
 /*    80 */    58,   59,   46,   47,   48,   49,   23,   51,   52,   53,
 /*    90 */    54,   55,   56,   57,   58,   59,   23,    4,   21,    6,
 /*   100 */    51,   52,   53,   54,   55,   56,   57,   58,   59,    4,
 /*   110 */     5,    6,   78,    8,    1,    1,    2,    3,   12,   85,
 /*   120 */    57,   58,   59,    9,    6,   32,   33,    4,   55,   56,
 /*   130 */    57,   58,   59,   18,   65,   66,   67,   32,   33,   70,
 /*   140 */    68,   69,   72,   73,   74,   74,   67,   75,   31,   70,
 /*   150 */    32,   33,   13,   14,   83,   84,   72,   73,   74,   72,
 /*   160 */    73,   74,    0,    1,    2,   71,   71,   71,   74,   74,
 /*   170 */    74,   73,   74,   71,   74,   78,   74,   27,   28,   78,
 /*   180 */    13,   14,   85,    4,   84,   78,   85,   78,   78,   25,
 /*   190 */    78,    0,   85,   71,   85,   85,   74,   85,   15,   25,
 /*   200 */     4,    6,    5,    0,   74,    7,   74,    8,   24,   19,
 /*   210 */    79,   77,   77,   11,   81,   30,   29,   77,   82,   26,
 /*   220 */    14,   80,   14,   18,   12,   15,   86,   59,
};
#define YY_SHIFT_USE_DFLT (-32)
#define YY_SHIFT_MAX 73
static const short yy_shift_ofst[] = {
 /*     0 */   114,  -16,  -16,   -7,  -31,  -31,  -31,  -31,  105,  105,
 /*    10 */   105,  105,  105,  105,  105,  105,  105,  105,  118,  118,
 /*    20 */   118,  162,  118,  118,  -31,  -31,   93,  -31,  184,  190,
 /*    30 */   190,  185,  187,  190,  193,  -23,  -23,   22,   -5,   36,
 /*    40 */    49,   73,   63,  167,  150,  139,   24,  206,  202,  208,
 /*    50 */   205,  212,  210,  168,    2,   10,   44,   77,  106,  113,
 /*    60 */   115,  123,  117,  179,  164,  191,  183,  174,  196,  197,
 /*    70 */   195,  198,  199,  203,
};
#define YY_REDUCE_USE_DFLT (-69)
#define YY_REDUCE_MAX 34
static const short yy_reduce_ofst[] = {
 /*     0 */    69,  -68,  -12,   72,   70,   71,   84,   87,  -58,  -20,
 /*    10 */   110,   97,  -22,  109,  112,  101,  107,   34,   95,  102,
 /*    20 */   122,   79,   94,   96,   98,  100,  130,  132,  131,  134,
 /*    30 */   135,  136,  133,  140,  141,
};
static const YYACTIONTYPE yy_default[] = {
 /*     0 */   113,  165,  165,  165,  165,  165,  165,  165,  165,  165,
 /*    10 */   165,  165,  165,  165,  165,  165,  165,  165,  165,  165,
 /*    20 */   165,  113,  165,  165,  165,  165,  165,  165,  134,  128,
 /*    30 */   128,  144,  142,  128,  136,  129,  137,  157,  156,  159,
 /*    40 */   158,  160,  161,  165,  165,  165,  165,  143,  165,  133,
 /*    50 */   165,  155,  122,  162,  117,  165,  165,  165,  165,  165,
 /*    60 */   165,  165,  145,  165,  165,  165,  141,  165,  165,  165,
 /*    70 */   165,  165,  165,  165,  110,  124,  149,  127,  150,  131,
 /*    80 */   126,  148,  147,  146,  135,  111,  121,  119,  164,  118,
 /*    90 */   123,  154,  125,  114,  163,  132,  138,  109,  120,  140,
 /*   100 */   112,  153,  152,  130,  139,  108,  151,
};
#define YY_SZ_ACTTAB (int)(sizeof(yy_action)/sizeof(yy_action[0]))

/* The next table maps tokens into fallback tokens.  If a construct
** like the following:
** 
**      %fallback ID X Y Z.
**
** appears in the grammer, then ID becomes a fallback token for X, Y,
** and Z.  Whenever one of the tokens X, Y, or Z is input to the parser
** but it does not parse, the type of the token is changed to ID and
** the parse is retried before an error is thrown.
*/
#ifdef YYFALLBACK
static const YYCODETYPE yyFallback[] = {
};
#endif /* YYFALLBACK */

/* The following structure represents a single element of the
** parser's stack.  Information stored includes:
**
**   +  The state number for the parser at this level of the stack.
**
**   +  The value of the token stored at this level of the stack.
**      (In other words, the "major" token.)
**
**   +  The semantic value stored at this level of the stack.  This is
**      the information used by the action routines in the grammar.
**      It is sometimes called the "minor" token.
*/
struct yyStackEntry {
  int stateno;       /* The state-number */
  int major;         /* The major token value.  This is the code
                     ** number for the token at this stack level */
  YYMINORTYPE minor; /* The user-supplied minor token value.  This
                     ** is the value of the token  */
};
typedef struct yyStackEntry yyStackEntry;

/* The state of the parser is completely contained in an instance of
** the following structure */
struct yyParser {
  int yyidx;                    /* Index of top element in stack */
  int yyerrcnt;                 /* Shifts left before out of the error */
  edbParserARG_SDECL                /* A place to hold %extra_argument */
#if YYSTACKDEPTH<=0
  int yystksz;                  /* Current side of the stack */
  yyStackEntry *yystack;        /* The parser's stack */
#else
  yyStackEntry yystack[YYSTACKDEPTH];  /* The parser's stack */
#endif
};
typedef struct yyParser yyParser;

#ifndef NDEBUG
#include <stdio.h>
static FILE *yyTraceFILE = 0;
static char *yyTracePrompt = 0;
#endif /* NDEBUG */

#ifndef NDEBUG
/* 
** Turn parser tracing on by giving a stream to which to write the trace
** and a prompt to preface each trace message.  Tracing is turned off
** by making either argument NULL 
**
** Inputs:
** <ul>
** <li> A FILE* to which trace output should be written.
**      If NULL, then tracing is turned off.
** <li> A prefix string written at the beginning of every
**      line of trace output.  If NULL, then tracing is
**      turned off.
** </ul>
**
** Outputs:
** None.
*/
void edbParserTrace(FILE *TraceFILE, char *zTracePrompt){
  yyTraceFILE = TraceFILE;
  yyTracePrompt = zTracePrompt;
  if( yyTraceFILE==0 ) yyTracePrompt = 0;
  else if( yyTracePrompt==0 ) yyTraceFILE = 0;
}
#endif /* NDEBUG */

#ifndef NDEBUG
/* For tracing shifts, the names of all terminals and nonterminals
** are required.  The following table supplies these names */
static const char *const yyTokenName[] = { 
  "$",             "SEMI",          "EXPLAIN",       "DOT",         
  "INTEGER",       "FLOAT",         "VARIABLE",      "REGISTER",    
  "BLOB",          "INTO",          "CREATE",        "DOMAIN",      
  "LP",            "RP",            "COMMA",         "COLON",       
  "DROP",          "DELETE",        "FROM",          "WHERE",       
  "INSERT",        "VALUES",        "SELECT",        "STAR",        
  "GROUP",         "BY",            "HAVING",        "ASC",         
  "DESC",          "ORDER",         "LIMIT",         "OFFSET",      
  "ID",            "STRING",        "OR",            "AND",         
  "NOT",           "IS",            "MATCH",         "LIKE_KW",     
  "BETWEEN",       "IN",            "ISNULL",        "NOTNULL",     
  "NE",            "EQ",            "GT",            "LE",          
  "LT",            "GE",            "ESCAPE",        "BITAND",      
  "BITOR",         "LSHIFT",        "RSHIFT",        "PLUS",        
  "MINUS",         "SLASH",         "REM",           "CONCAT",      
  "COLLATE",       "UMINUS",        "UPLUS",         "BITNOT",      
  "error",         "input",         "cmdlist",       "ecmd",        
  "cmdx",          "cmd",           "explain",       "domain_nm",   
  "attributelist",  "attribute",     "nm",            "drop_domain", 
  "selattrlist",   "where_opt",     "expr",          "groupby_opt", 
  "having_opt",    "orderby_opt",   "limit_opt",     "sortorderlist",
  "sortorder",     "term",        
};
#endif /* NDEBUG */

#ifndef NDEBUG
/* For tracing reduce actions, the names of all rules are required.
*/
static const char *const yyRuleName[] = {
 /*   0 */ "input ::= cmdlist",
 /*   1 */ "cmdlist ::= cmdlist ecmd",
 /*   2 */ "cmdlist ::= ecmd",
 /*   3 */ "cmdx ::= cmd",
 /*   4 */ "ecmd ::= SEMI",
 /*   5 */ "ecmd ::= explain cmdx SEMI",
 /*   6 */ "explain ::=",
 /*   7 */ "explain ::= EXPLAIN",
 /*   8 */ "input ::= DOT INTEGER FLOAT VARIABLE REGISTER BLOB",
 /*   9 */ "input ::= INTO",
 /*  10 */ "cmd ::= CREATE DOMAIN domain_nm",
 /*  11 */ "cmd ::= CREATE DOMAIN domain_nm LP attributelist RP",
 /*  12 */ "attributelist ::= attributelist COMMA attribute",
 /*  13 */ "attributelist ::= attribute",
 /*  14 */ "attribute ::= nm COLON nm",
 /*  15 */ "attribute ::= nm",
 /*  16 */ "attribute ::= nm COLON VARIABLE",
 /*  17 */ "attribute ::= nm COLON INTEGER",
 /*  18 */ "cmd ::= drop_domain",
 /*  19 */ "drop_domain ::= DROP DOMAIN domain_nm",
 /*  20 */ "cmd ::= DELETE selattrlist FROM domain_nm where_opt",
 /*  21 */ "where_opt ::=",
 /*  22 */ "where_opt ::= WHERE expr",
 /*  23 */ "cmd ::= INSERT INTO domain_nm VALUES LP attributelist RP where_opt",
 /*  24 */ "cmd ::= SELECT selattrlist FROM domain_nm where_opt groupby_opt having_opt orderby_opt limit_opt",
 /*  25 */ "selattrlist ::= STAR",
 /*  26 */ "selattrlist ::= attributelist",
 /*  27 */ "groupby_opt ::=",
 /*  28 */ "groupby_opt ::= GROUP BY nm",
 /*  29 */ "having_opt ::=",
 /*  30 */ "having_opt ::= HAVING expr",
 /*  31 */ "sortorderlist ::= sortorderlist COMMA sortorder",
 /*  32 */ "sortorderlist ::= sortorder",
 /*  33 */ "sortorder ::= nm COLON ASC|DESC",
 /*  34 */ "sortorder ::= nm",
 /*  35 */ "orderby_opt ::=",
 /*  36 */ "orderby_opt ::= ORDER BY sortorderlist",
 /*  37 */ "limit_opt ::=",
 /*  38 */ "limit_opt ::= LIMIT INTEGER",
 /*  39 */ "limit_opt ::= LIMIT INTEGER OFFSET INTEGER",
 /*  40 */ "domain_nm ::= VARIABLE",
 /*  41 */ "domain_nm ::= nm",
 /*  42 */ "nm ::= ID",
 /*  43 */ "nm ::= STRING",
 /*  44 */ "expr ::= term",
 /*  45 */ "term ::= STRING",
 /*  46 */ "term ::= INTEGER|FLOAT|BLOB",
 /*  47 */ "term ::= VARIABLE",
 /*  48 */ "expr ::= ID",
 /*  49 */ "expr ::= expr AND expr",
 /*  50 */ "expr ::= expr OR expr",
 /*  51 */ "expr ::= expr LT|GT|GE|LE expr",
 /*  52 */ "expr ::= expr EQ|NE expr",
 /*  53 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr",
 /*  54 */ "expr ::= expr PLUS|MINUS expr",
 /*  55 */ "expr ::= expr STAR|SLASH|REM expr",
 /*  56 */ "expr ::= expr CONCAT expr",
 /*  57 */ "expr ::= ID LP attributelist RP",
};
#endif /* NDEBUG */


#if YYSTACKDEPTH<=0
/*
** Try to increase the size of the parser stack.
*/
static void yyGrowStack(yyParser *p){
  int newSize;
  yyStackEntry *pNew;

  newSize = p->yystksz*2 + 100;
  pNew = realloc(p->yystack, newSize*sizeof(pNew[0]));
  if( pNew ){
    p->yystack = pNew;
    p->yystksz = newSize;
#ifndef NDEBUG
    if( yyTraceFILE ){
      fprintf(yyTraceFILE,"%sStack grows to %d entries!\n",
              yyTracePrompt, p->yystksz);
    }
#endif
  }
}
#endif

/* 
** This function allocates a new parser.
** The only argument is a pointer to a function which works like
** malloc.
**
** Inputs:
** A pointer to the function used to allocate memory.
**
** Outputs:
** A pointer to a parser.  This pointer is used in subsequent calls
** to edbParser and edbParserFree.
*/
void *edbParserAlloc(void *(*mallocProc)(size_t)){
  yyParser *pParser;
  pParser = (yyParser*)(*mallocProc)( (size_t)sizeof(yyParser) );
  if( pParser ){
    pParser->yyidx = -1;
#if YYSTACKDEPTH<=0
    yyGrowStack(pParser);
#endif
  }
  return pParser;
}

/* The following function deletes the value associated with a
** symbol.  The symbol can be either a terminal or nonterminal.
** "yymajor" is the symbol code, and "yypminor" is a pointer to
** the value.
*/
static void yy_destructor(YYCODETYPE yymajor, YYMINORTYPE *yypminor){
  switch( yymajor ){
    /* Here is inserted the actions which take place when a
    ** terminal or non-terminal is destroyed.  This can happen
    ** when the symbol is popped from the stack during a
    ** reduce or during error processing or when a parser is 
    ** being destroyed before it is finished parsing.
    **
    ** Note: during a reduce, the only symbols destroyed are those
    ** which appear on the RHS of the rule, but which are not used
    ** inside the C code.
    */
    case 71: /* domain_nm */
    case 74: /* nm */
#line 191 "parse.y"
{ edbDestroyToken((yypminor->yy108)); }
#line 467 "parse.c"
      break;
    case 72: /* attributelist */
    case 76: /* selattrlist */
    case 83: /* sortorderlist */
#line 87 "parse.y"
{edbAttrListDestroy((yypminor->yy6));}
#line 474 "parse.c"
      break;
    case 73: /* attribute */
    case 84: /* sortorder */
#line 93 "parse.y"
{ edbDestroyAttrValue((yypminor->yy123)); }
#line 480 "parse.c"
      break;
    default:  break;   /* If no destructor action specified: do nothing */
  }
}

/*
** Pop the parser's stack once.
**
** If there is a destructor routine associated with the token which
** is popped from the stack, then call it.
**
** Return the major token number for the symbol popped.
*/
static int yy_pop_parser_stack(yyParser *pParser){
  YYCODETYPE yymajor;
  yyStackEntry *yytos = &pParser->yystack[pParser->yyidx];

  if( pParser->yyidx<0 ) return 0;
#ifndef NDEBUG
  if( yyTraceFILE && pParser->yyidx>=0 ){
    fprintf(yyTraceFILE,"%sPopping %s\n",
      yyTracePrompt,
      yyTokenName[yytos->major]);
  }
#endif
  yymajor = yytos->major;
  yy_destructor( yymajor, &yytos->minor);
  pParser->yyidx--;
  return yymajor;
}

/* 
** Deallocate and destroy a parser.  Destructors are all called for
** all stack elements before shutting the parser down.
**
** Inputs:
** <ul>
** <li>  A pointer to the parser.  This should be a pointer
**       obtained from edbParserAlloc.
** <li>  A pointer to a function used to reclaim memory obtained
**       from malloc.
** </ul>
*/
void edbParserFree(
  void *p,                    /* The parser to be deleted */
  void (*freeProc)(void*)     /* Function used to reclaim memory */
){
  yyParser *pParser = (yyParser*)p;
  if( pParser==0 ) return;
  while( pParser->yyidx>=0 ) yy_pop_parser_stack(pParser);
#if YYSTACKDEPTH<=0
  free(pParser->yystack);
#endif
  (*freeProc)((void*)pParser);
}

/*
** Find the appropriate action for a parser given the terminal
** look-ahead token iLookAhead.
**
** If the look-ahead token is YYNOCODE, then check to see if the action is
** independent of the look-ahead.  If it is, return the action, otherwise
** return YY_NO_ACTION.
*/
static int yy_find_shift_action(
  yyParser *pParser,        /* The parser */
  YYCODETYPE iLookAhead     /* The look-ahead token */
){
  int i;
  int stateno = pParser->yystack[pParser->yyidx].stateno;
 
  if( stateno>YY_SHIFT_MAX || (i = yy_shift_ofst[stateno])==YY_SHIFT_USE_DFLT ){
    return yy_default[stateno];
  }
  assert( iLookAhead!=YYNOCODE );
  i += iLookAhead;
  if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){
    if( iLookAhead>0 ){
#ifdef YYFALLBACK
      int iFallback;            /* Fallback token */
      if( iLookAhead<sizeof(yyFallback)/sizeof(yyFallback[0])
             && (iFallback = yyFallback[iLookAhead])!=0 ){
#ifndef NDEBUG
        if( yyTraceFILE ){
          fprintf(yyTraceFILE, "%sFALLBACK %s => %s\n",
             yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]);
        }
#endif
        return yy_find_shift_action(pParser, iFallback);
      }
#endif
#ifdef YYWILDCARD
      {
        int j = i - iLookAhead + YYWILDCARD;
        if( j>=0 && j<YY_SZ_ACTTAB && yy_lookahead[j]==YYWILDCARD ){
#ifndef NDEBUG
          if( yyTraceFILE ){
            fprintf(yyTraceFILE, "%sWILDCARD %s => %s\n",
               yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[YYWILDCARD]);
          }
#endif /* NDEBUG */
          return yy_action[j];
        }
      }
#endif /* YYWILDCARD */
    }
    return yy_default[stateno];
  }else{
    return yy_action[i];
  }
}

/*
** Find the appropriate action for a parser given the non-terminal
** look-ahead token iLookAhead.
**
** If the look-ahead token is YYNOCODE, then check to see if the action is
** independent of the look-ahead.  If it is, return the action, otherwise
** return YY_NO_ACTION.
*/
static int yy_find_reduce_action(
  int stateno,              /* Current state number */
  YYCODETYPE iLookAhead     /* The look-ahead token */
){
  int i;
  assert( stateno<=YY_REDUCE_MAX );
  i = yy_reduce_ofst[stateno];
  assert( i!=YY_REDUCE_USE_DFLT );
  assert( iLookAhead!=YYNOCODE );
  i += iLookAhead;
  assert( i>=0 && i<YY_SZ_ACTTAB );
  assert( yy_lookahead[i]==iLookAhead );
  return yy_action[i];
}

/*
** The following routine is called if the stack overflows.
*/
static void yyStackOverflow(yyParser *yypParser, YYMINORTYPE *yypMinor){
   edbParserARG_FETCH;
   yypParser->yyidx--;
#ifndef NDEBUG
   if( yyTraceFILE ){
     fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt);
   }
#endif
   while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);
   /* Here code is inserted which will execute if the parser
   ** stack every overflows */
#line 49 "parse.y"

//  sqlite3ErrorMsg(pParse, "parser stack overflow");
//  pParse->parseError = 1;
	printf("parser stack overflow\n");
#line 636 "parse.c"
   edbParserARG_STORE; /* Suppress warning about unused %extra_argument var */
}

/*
** Perform a shift action.
*/
static void yy_shift(
  yyParser *yypParser,          /* The parser to be shifted */
  int yyNewState,               /* The new state to shift in */
  int yyMajor,                  /* The major token to shift in */
  YYMINORTYPE *yypMinor         /* Pointer ot the minor token to shift in */
){
  yyStackEntry *yytos;
  yypParser->yyidx++;
#if YYSTACKDEPTH>0 
  if( yypParser->yyidx>=YYSTACKDEPTH ){
    yyStackOverflow(yypParser, yypMinor);
    return;
  }
#else
  if( yypParser->yyidx>=yypParser->yystksz ){
    yyGrowStack(yypParser);
    if( yypParser->yyidx>=yypParser->yystksz ){
      yyStackOverflow(yypParser, yypMinor);
      return;
    }
  }
#endif
  yytos = &yypParser->yystack[yypParser->yyidx];
  yytos->stateno = yyNewState;
  yytos->major = yyMajor;
  yytos->minor = *yypMinor;
#ifndef NDEBUG
  if( yyTraceFILE && yypParser->yyidx>0 ){
    int i;
    fprintf(yyTraceFILE,"%sShift %d\n",yyTracePrompt,yyNewState);
    fprintf(yyTraceFILE,"%sStack:",yyTracePrompt);
    for(i=1; i<=yypParser->yyidx; i++)
      fprintf(yyTraceFILE," %s",yyTokenName[yypParser->yystack[i].major]);
    fprintf(yyTraceFILE,"\n");
  }
#endif
}

/* The following table contains information about every rule that
** is used during the reduce.
*/
static const struct {
  YYCODETYPE lhs;         /* Symbol on the left-hand side of the rule */
  unsigned char nrhs;     /* Number of right-hand side symbols in the rule */
} yyRuleInfo[] = {
  { 65, 1 },
  { 66, 2 },
  { 66, 1 },
  { 68, 1 },
  { 67, 1 },
  { 67, 3 },
  { 70, 0 },
  { 70, 1 },
  { 65, 6 },
  { 65, 1 },
  { 69, 3 },
  { 69, 6 },
  { 72, 3 },
  { 72, 1 },
  { 73, 3 },
  { 73, 1 },
  { 73, 3 },
  { 73, 3 },
  { 69, 1 },
  { 75, 3 },
  { 69, 5 },
  { 77, 0 },
  { 77, 2 },
  { 69, 8 },
  { 69, 9 },
  { 76, 1 },
  { 76, 1 },
  { 79, 0 },
  { 79, 3 },
  { 80, 0 },
  { 80, 2 },
  { 83, 3 },
  { 83, 1 },
  { 84, 3 },
  { 84, 1 },
  { 81, 0 },
  { 81, 3 },
  { 82, 0 },
  { 82, 2 },
  { 82, 4 },
  { 71, 1 },
  { 71, 1 },
  { 74, 1 },
  { 74, 1 },
  { 78, 1 },
  { 85, 1 },
  { 85, 1 },
  { 85, 1 },
  { 78, 1 },
  { 78, 3 },
  { 78, 3 },
  { 78, 3 },
  { 78, 3 },
  { 78, 3 },
  { 78, 3 },
  { 78, 3 },
  { 78, 3 },
  { 78, 4 },
};

static void yy_accept(yyParser*);  /* Forward Declaration */

/*
** Perform a reduce action and the shift that must immediately
** follow the reduce.
*/
static void yy_reduce(
  yyParser *yypParser,         /* The parser */
  int yyruleno                 /* Number of the rule by which to reduce */
){
  int yygoto;                     /* The next state */
  int yyact;                      /* The next action */
  YYMINORTYPE yygotominor;        /* The LHS of the rule reduced */
  yyStackEntry *yymsp;            /* The top of the parser's stack */
  int yysize;                     /* Amount to pop the stack */
  edbParserARG_FETCH;
  yymsp = &yypParser->yystack[yypParser->yyidx];
#ifndef NDEBUG
  if( yyTraceFILE && yyruleno>=0 
        && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){
    fprintf(yyTraceFILE, "%sReduce [%s].\n", yyTracePrompt,
      yyRuleName[yyruleno]);
  }
#endif /* NDEBUG */

  /* Silence complaints from purify about yygotominor being uninitialized
  ** in some cases when it is copied into the stack after the following
  ** switch.  yygotominor is uninitialized when a rule reduces that does
  ** not set the value of its left-hand side nonterminal.  Leaving the
  ** value of the nonterminal uninitialized is utterly harmless as long
  ** as the value is never used.  So really the only thing this code
  ** accomplishes is to quieten purify.  
  **
  ** 2007-01-16:  The wireshark project (www.wireshark.org) reports that
  ** without this code, their parser segfaults.  I'm not sure what there
  ** parser is doing to make this happen.  This is the second bug report
  ** from wireshark this week.  Clearly they are stressing Lemon in ways
  ** that it has not been previously stressed...  (SQLite ticket #2172)
  */
  memset(&yygotominor, 0, sizeof(yygotominor));


  switch( yyruleno ){
  /* Beginning here are the reduction cases.  A typical example
  ** follows:
  **   case 0:
  **  #line <lineno> <grammarfile>
  **     { ... }           // User supplied code
  **  #line <lineno> <thisfile>
  **     break;
  */
      case 0: /* input ::= cmdlist */
      case 1: /* cmdlist ::= cmdlist ecmd */
      case 2: /* cmdlist ::= ecmd */
      case 4: /* ecmd ::= SEMI */
      case 5: /* ecmd ::= explain cmdx SEMI */
      case 18: /* cmd ::= drop_domain */
#line 64 "parse.y"
{
}
#line 808 "parse.c"
        break;
      case 3: /* cmdx ::= cmd */
#line 67 "parse.y"
{ edbFinishCoding(pParse); }
#line 813 "parse.c"
        break;
      case 6: /* explain ::= */
#line 70 "parse.y"
{ edbBeginParse(pParse, 0); }
#line 818 "parse.c"
        break;
      case 7: /* explain ::= EXPLAIN */
#line 71 "parse.y"
{ edbBeginParse(pParse, 1); }
#line 823 "parse.c"
        break;
      case 8: /* input ::= DOT INTEGER FLOAT VARIABLE REGISTER BLOB */
      case 9: /* input ::= INTO */
#line 74 "parse.y"
{ }
#line 829 "parse.c"
        break;
      case 10: /* cmd ::= CREATE DOMAIN domain_nm */
#line 79 "parse.y"
{
	edbCreateDomain(pParse,yymsp[0].minor.yy108,0);
}
#line 836 "parse.c"
        break;
      case 11: /* cmd ::= CREATE DOMAIN domain_nm LP attributelist RP */
#line 82 "parse.y"
{
	edbCreateDomain(pParse,yymsp[-3].minor.yy108,yymsp[-1].minor.yy6);	
}
#line 843 "parse.c"
        break;
      case 12: /* attributelist ::= attributelist COMMA attribute */
      case 31: /* sortorderlist ::= sortorderlist COMMA sortorder */
#line 89 "parse.y"
{ yygotominor.yy6 = edbAppendAttrList(pParse, yymsp[-2].minor.yy6, yymsp[0].minor.yy123 ); }
#line 849 "parse.c"
        break;
      case 13: /* attributelist ::= attribute */
      case 32: /* sortorderlist ::= sortorder */
#line 90 "parse.y"
{ yygotominor.yy6 = edbAppendAttrList(pParse, 0, yymsp[0].minor.yy123 ); }
#line 855 "parse.c"
        break;
      case 14: /* attribute ::= nm COLON nm */
#line 95 "parse.y"
{ yygotominor.yy123 = edbCreateAttrValue(pParse, yymsp[-2].minor.yy108, yymsp[0].minor.yy108); }
#line 860 "parse.c"
        break;
      case 15: /* attribute ::= nm */
      case 34: /* sortorder ::= nm */
#line 96 "parse.y"
{ yygotominor.yy123 = edbCreateAttrValue(pParse, yymsp[0].minor.yy108, 0 ); }
#line 866 "parse.c"
        break;
      case 16: /* attribute ::= nm COLON VARIABLE */
#line 97 "parse.y"
{ yygotominor.yy123 = edbCreateAttrValue(pParse, yymsp[-2].minor.yy108, edbResolveVariable(pParse, &yymsp[0].minor.yy0) ); }
#line 871 "parse.c"
        break;
      case 17: /* attribute ::= nm COLON INTEGER */
#line 98 "parse.y"
{ yygotominor.yy123 = edbCreateAttrValueFromInteger(pParse, yymsp[-2].minor.yy108, &yymsp[0].minor.yy0); }
#line 876 "parse.c"
        break;
      case 19: /* drop_domain ::= DROP DOMAIN domain_nm */
#line 115 "parse.y"
{
	edbDropDomain(pParse,yymsp[0].minor.yy108);
}
#line 883 "parse.c"
        break;
      case 20: /* cmd ::= DELETE selattrlist FROM domain_nm where_opt */
#line 121 "parse.y"
{edbDeleteFrom(pParse,yymsp[-1].minor.yy108,yymsp[0].minor.yy95,yymsp[-3].minor.yy6);}
#line 888 "parse.c"
        break;
      case 21: /* where_opt ::= */
#line 126 "parse.y"
{yygotominor.yy95 = 0;}
#line 893 "parse.c"
        break;
      case 22: /* where_opt ::= WHERE expr */
      case 44: /* expr ::= term */
#line 127 "parse.y"
{yygotominor.yy95 = yymsp[0].minor.yy95;}
#line 899 "parse.c"
        break;
      case 23: /* cmd ::= INSERT INTO domain_nm VALUES LP attributelist RP where_opt */
#line 132 "parse.y"
{ edbInsert(pParse, yymsp[-5].minor.yy108, yymsp[-2].minor.yy6, yymsp[0].minor.yy95 ); }
#line 904 "parse.c"
        break;
      case 24: /* cmd ::= SELECT selattrlist FROM domain_nm where_opt groupby_opt having_opt orderby_opt limit_opt */
#line 137 "parse.y"
{ edbSelect(pParse, yymsp[-7].minor.yy6,yymsp[-5].minor.yy108,yymsp[-4].minor.yy95,yymsp[-3].minor.yy108,yymsp[-2].minor.yy108,yymsp[-1].minor.yy6,yymsp[0].minor.yy6); }
#line 909 "parse.c"
        break;
      case 25: /* selattrlist ::= STAR */
      case 35: /* orderby_opt ::= */
      case 37: /* limit_opt ::= */
#line 141 "parse.y"
{yygotominor.yy6 = 0;}
#line 916 "parse.c"
        break;
      case 26: /* selattrlist ::= attributelist */
      case 36: /* orderby_opt ::= ORDER BY sortorderlist */
#line 142 "parse.y"
{yygotominor.yy6 = yymsp[0].minor.yy6;}
#line 922 "parse.c"
        break;
      case 27: /* groupby_opt ::= */
      case 29: /* having_opt ::= */
#line 147 "parse.y"
{yygotominor.yy108 = 0;}
#line 928 "parse.c"
        break;
      case 28: /* groupby_opt ::= GROUP BY nm */
#line 148 "parse.y"
{yygotominor.yy108 = 0;(void)yymsp[0].minor.yy108;}
#line 933 "parse.c"
        break;
      case 30: /* having_opt ::= HAVING expr */
#line 152 "parse.y"
{yygotominor.yy108 = 0;(void)yymsp[0].minor.yy95;}
#line 938 "parse.c"
        break;
      case 33: /* sortorder ::= nm COLON ASC|DESC */
#line 165 "parse.y"
{ yygotominor.yy123 = edbCreateAttrValue(pParse, yymsp[-2].minor.yy108, &yymsp[0].minor.yy0); }
#line 943 "parse.c"
        break;
      case 38: /* limit_opt ::= LIMIT INTEGER */
#line 177 "parse.y"
{
	yygotominor.yy6 = edbAppendAttrList(pParse, 0, edbCreateAttrValueCStr(pParse, "limit", &yymsp[0].minor.yy0));
}
#line 950 "parse.c"
        break;
      case 39: /* limit_opt ::= LIMIT INTEGER OFFSET INTEGER */
#line 180 "parse.y"
{
	yygotominor.yy6 = edbAppendAttrList(pParse, 0, edbCreateAttrValueCStr(pParse, "limit", &yymsp[-2].minor.yy0));
	yygotominor.yy6 = edbAppendAttrList(pParse, yygotominor.yy6, edbCreateAttrValueCStr(pParse, "offset", &yymsp[0].minor.yy0));
}
#line 958 "parse.c"
        break;
      case 40: /* domain_nm ::= VARIABLE */
#line 193 "parse.y"
{yygotominor.yy108 = edbResolveVariable(pParse, &yymsp[0].minor.yy0);}
#line 963 "parse.c"
        break;
      case 41: /* domain_nm ::= nm */
#line 194 "parse.y"
{yygotominor.yy108 = yymsp[0].minor.yy108;}
#line 968 "parse.c"
        break;
      case 42: /* nm ::= ID */
#line 198 "parse.y"
{yygotominor.yy108 = edbValueFromID(pParse,&yymsp[0].minor.yy0);}
#line 973 "parse.c"
        break;
      case 43: /* nm ::= STRING */
#line 199 "parse.y"
{yygotominor.yy108 = edbDequote(pParse,&yymsp[0].minor.yy0);}
#line 978 "parse.c"
        break;
      case 45: /* term ::= STRING */
#line 241 "parse.y"
{yygotominor.yy95 = edbExpr(pParse, yymsp[0].major, 0, 0, edbDequote(pParse,&yymsp[0].minor.yy0));}
#line 983 "parse.c"
        break;
      case 46: /* term ::= INTEGER|FLOAT|BLOB */
#line 242 "parse.y"
{yygotominor.yy95 = edbExpr(pParse, yymsp[0].major, 0, 0, &yymsp[0].minor.yy0);}
#line 988 "parse.c"
        break;
      case 47: /* term ::= VARIABLE */
#line 243 "parse.y"
{yygotominor.yy95 = edbExpr(pParse, yymsp[0].major, 0, 0, edbResolveVariable(pParse, &yymsp[0].minor.yy0));}
#line 993 "parse.c"
        break;
      case 48: /* expr ::= ID */
#line 244 "parse.y"
{yygotominor.yy95 = edbExpr(pParse, TK_ID, 0, 0, &yymsp[0].minor.yy0);}
#line 998 "parse.c"
        break;
      case 49: /* expr ::= expr AND expr */
      case 50: /* expr ::= expr OR expr */
      case 51: /* expr ::= expr LT|GT|GE|LE expr */
      case 52: /* expr ::= expr EQ|NE expr */
      case 53: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
      case 54: /* expr ::= expr PLUS|MINUS expr */
      case 55: /* expr ::= expr STAR|SLASH|REM expr */
      case 56: /* expr ::= expr CONCAT expr */
#line 246 "parse.y"
{yygotominor.yy95 = edbExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy95,yymsp[0].minor.yy95,0);}
#line 1010 "parse.c"
        break;
      case 57: /* expr ::= ID LP attributelist RP */
#line 258 "parse.y"
{yygotominor.yy95 = edbExprFunction(pParse,&yymsp[-3].minor.yy0,yymsp[-1].minor.yy6);}
#line 1015 "parse.c"
        break;
  };
  yygoto = yyRuleInfo[yyruleno].lhs;
  yysize = yyRuleInfo[yyruleno].nrhs;
  yypParser->yyidx -= yysize;
  yyact = yy_find_reduce_action(yymsp[-yysize].stateno,yygoto);
  if( yyact < YYNSTATE ){
#ifdef NDEBUG
    /* If we are not debugging and the reduce action popped at least
    ** one element off the stack, then we can push the new element back
    ** onto the stack here, and skip the stack overflow test in yy_shift().
    ** That gives a significant speed improvement. */
    if( yysize ){
      yypParser->yyidx++;
      yymsp -= yysize-1;
      yymsp->stateno = yyact;
      yymsp->major = yygoto;
      yymsp->minor = yygotominor;
    }else
#endif
    {
      yy_shift(yypParser,yyact,yygoto,&yygotominor);
    }
  }else{
    assert( yyact == YYNSTATE + YYNRULE + 1 );
    yy_accept(yypParser);
  }
}

/*
** The following code executes when the parse fails
*/
static void yy_parse_failed(
  yyParser *yypParser           /* The parser */
){
  edbParserARG_FETCH;
#ifndef NDEBUG
  if( yyTraceFILE ){
    fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt);
  }
#endif
  while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);
  /* Here code is inserted which will be executed whenever the
  ** parser fails */
  edbParserARG_STORE; /* Suppress warning about unused %extra_argument variable */
}

/*
** The following code executes when a syntax error first occurs.
*/
static void yy_syntax_error(
  yyParser *yypParser,           /* The parser */
  int yymajor,                   /* The major type of the error token */
  YYMINORTYPE yyminor            /* The minor type of the error token */
){
  edbParserARG_FETCH;
#define TOKEN (yyminor.yy0)
#line 43 "parse.y"

//  assert( TOKEN.z[0] );  /* The tokenizer always gives us a token */
//  sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", &TOKEN);
	printf("Syntax error\n");
	pParse->parseError = 1;
#line 1080 "parse.c"
  edbParserARG_STORE; /* Suppress warning about unused %extra_argument variable */
}

/*
** The following is executed when the parser accepts
*/
static void yy_accept(
  yyParser *yypParser           /* The parser */
){
  edbParserARG_FETCH;
#ifndef NDEBUG
  if( yyTraceFILE ){
    fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt);
  }
#endif
  while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);
  /* Here code is inserted which will be executed whenever the
  ** parser accepts */
  edbParserARG_STORE; /* Suppress warning about unused %extra_argument variable */
}

/* The main parser program.
** The first argument is a pointer to a structure obtained from
** "edbParserAlloc" which describes the current state of the parser.
** The second argument is the major token number.  The third is
** the minor token.  The fourth optional argument is whatever the
** user wants (and specified in the grammar) and is available for
** use by the action routines.
**
** Inputs:
** <ul>
** <li> A pointer to the parser (an opaque structure.)
** <li> The major token number.
** <li> The minor token number.
** <li> An option argument of a grammar-specified type.
** </ul>
**
** Outputs:
** None.
*/
void edbParser(
  void *yyp,                   /* The parser */
  int yymajor,                 /* The major token code number */
  edbParserTOKENTYPE yyminor       /* The value for the token */
  edbParserARG_PDECL               /* Optional %extra_argument parameter */
){
  YYMINORTYPE yyminorunion;
  int yyact;            /* The parser action. */
  int yyendofinput;     /* True if we are at the end of input */
#ifdef YYERRORSYMBOL
  int yyerrorhit = 0;   /* True if yymajor has invoked an error */
#endif
  yyParser *yypParser;  /* The parser */

  /* (re)initialize the parser, if necessary */
  yypParser = (yyParser*)yyp;
  if( yypParser->yyidx<0 ){
#if YYSTACKDEPTH<=0
    if( yypParser->yystksz <=0 ){
      memset(&yyminorunion, 0, sizeof(yyminorunion));
      yyStackOverflow(yypParser, &yyminorunion);
      return;
    }
#endif
    yypParser->yyidx = 0;
    yypParser->yyerrcnt = -1;
    yypParser->yystack[0].stateno = 0;
    yypParser->yystack[0].major = 0;
  }
  yyminorunion.yy0 = yyminor;
  yyendofinput = (yymajor==0);
  edbParserARG_STORE;

#ifndef NDEBUG
  if( yyTraceFILE ){
    fprintf(yyTraceFILE,"%sInput %s\n",yyTracePrompt,yyTokenName[yymajor]);
  }
#endif

  do{
    yyact = yy_find_shift_action(yypParser,yymajor);
    if( yyact<YYNSTATE ){
      assert( !yyendofinput );  /* Impossible to shift the $ token */
      yy_shift(yypParser,yyact,yymajor,&yyminorunion);
      yypParser->yyerrcnt--;
      yymajor = YYNOCODE;
    }else if( yyact < YYNSTATE + YYNRULE ){
      yy_reduce(yypParser,yyact-YYNSTATE);
    }else{
      assert( yyact == YY_ERROR_ACTION );
#ifdef YYERRORSYMBOL
      int yymx;
#endif
#ifndef NDEBUG
      if( yyTraceFILE ){
        fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt);
      }
#endif
#ifdef YYERRORSYMBOL
      /* A syntax error has occurred.
      ** The response to an error depends upon whether or not the
      ** grammar defines an error token "ERROR".  
      **
      ** This is what we do if the grammar does define ERROR:
      **
      **  * Call the %syntax_error function.
      **
      **  * Begin popping the stack until we enter a state where
      **    it is legal to shift the error symbol, then shift
      **    the error symbol.
      **
      **  * Set the error count to three.
      **
      **  * Begin accepting and shifting new tokens.  No new error
      **    processing will occur until three tokens have been
      **    shifted successfully.
      **
      */
      if( yypParser->yyerrcnt<0 ){
        yy_syntax_error(yypParser,yymajor,yyminorunion);
      }
      yymx = yypParser->yystack[yypParser->yyidx].major;
      if( yymx==YYERRORSYMBOL || yyerrorhit ){
#ifndef NDEBUG
        if( yyTraceFILE ){
          fprintf(yyTraceFILE,"%sDiscard input token %s\n",
             yyTracePrompt,yyTokenName[yymajor]);
        }
#endif
        yy_destructor(yymajor,&yyminorunion);
        yymajor = YYNOCODE;
      }else{
         while(
          yypParser->yyidx >= 0 &&
          yymx != YYERRORSYMBOL &&
          (yyact = yy_find_reduce_action(
                        yypParser->yystack[yypParser->yyidx].stateno,
                        YYERRORSYMBOL)) >= YYNSTATE
        ){
          yy_pop_parser_stack(yypParser);
        }
        if( yypParser->yyidx < 0 || yymajor==0 ){
          yy_destructor(yymajor,&yyminorunion);
          yy_parse_failed(yypParser);
          yymajor = YYNOCODE;
        }else if( yymx!=YYERRORSYMBOL ){
          YYMINORTYPE u2;
          u2.YYERRSYMDT = 0;
          yy_shift(yypParser,yyact,YYERRORSYMBOL,&u2);
        }
      }
      yypParser->yyerrcnt = 3;
      yyerrorhit = 1;
#else  /* YYERRORSYMBOL is not defined */
      /* This is what we do if the grammar does not define ERROR:
      **
      **  * Report an error message, and throw away the input token.
      **
      **  * If the input token is $, then fail the parse.
      **
      ** As before, subsequent error messages are suppressed until
      ** three input tokens have been successfully shifted.
      */
      if( yypParser->yyerrcnt<=0 ){
        yy_syntax_error(yypParser,yymajor,yyminorunion);
      }
      yypParser->yyerrcnt = 3;
      yy_destructor(yymajor,&yyminorunion);
      if( yyendofinput ){
        yy_parse_failed(yypParser);
      }
      yymajor = YYNOCODE;
#endif
    }
  }while( yymajor!=YYNOCODE && yypParser->yyidx>=0 );
  return;
}
